import { BblHomeContent } from "../entity/home.content.entity";
import { BblHomeSection } from "../entity/home.section.entity";
import { AttachDto } from "./att.dto";

export class SectionCreateDto {
  isSectionTopicVisible: number;
  sectionMainTopic: string;
  sectionSubTopic: string;
  sectionIndex: number;
}

export class BannerCreateDto {
  bannerIndex: number;
  attId: string;
}

export class ContentCreateDto {
  contentType: number;
  sectionId: string;
  attId: string;
  contentText: string;
  contentIndex: number;
}

export class ContentDto {
  constructor(content: BblHomeContent) {
    this.contentId = content.contentId;
    this.contentType = content.contentType;
    this.contentIndex = content.contentIndex;
    if (this.contentType === 0) {
      this.contentImg = new AttachDto(content.contentImg);
    } else if (this.contentType === 1) {
      this.contentText = content.contentText;
    }
  }

  contentId: string;
  contentType: number;
  contentImg: AttachDto;
  contentText: string;
  contentIndex: number;
}

export class SectionDto {
  constructor(section: BblHomeSection) {
    this.sectionId = section.sectionId;
    this.isSectionTopicVisible = section.isSectionTopicVisible;
    this.sectionMainTopic = section.sectionMainTopic;
    this.sectionSubTopic = section.sectionSubTopic;
    this.sectionIndex = section.sectionIndex;
  }

  sectionId: string;
  isSectionTopicVisible: number;
  sectionMainTopic: string;
  sectionSubTopic: string;
  sectionIndex: number;
}
